<template>
  <div>
    <div>
      <h2>
        列表
        <router-link :to="{ name: 'techExpertDetail', params: { id: 1 } }">
          详情1
        </router-link>
        <router-link :to="{ name: 'techExpertDetail', params: { id: 2 } }">
          2
        </router-link>
        <router-link :to="{ name: 'techExpertDetail', params: { id: 3 } }">
          3
        </router-link>
      </h2>
    </div>

    <!-- <router-view v-if="!isList"> </router-view> -->
  </div>
</template>

<script>
export default {
  name: 'techExpertList',
  data() {
    return {
      isList: 1,
    }
  },
  watch: {
    $route(v) {
      let name = v.name

      if (name.indexOf('详情') !== -1) {
        this.isList = 0
      } else {
        this.isList = 1
      }
    },
  },
  beforeRouteEnter(to, from, next) {
    let name = to.name

    next((vm) => {
      if (name.indexOf('详情') !== -1) {
        vm.isList = 0
      } else {
        vm.isList = 1
      }
    })
  },
  created() {},
}
</script>

<style></style>
